import request from '@/utils/request'

/**
 * 获取所有索引
 * @returns 
 */
export function allindex(indexName) {
  let url = '/index/all';
  if (indexName) {
    url = url + '?indexName=' + indexName;
  }
  return request({
    url: url,
    method: 'get'
  })
}

export function deleteIndex(indexName) {
  return request({
    url: '/index/remove/' + indexName,
    method: 'get'
  })
}

export function createIndex(params) {
  return request({
    url: '/index/create',
    method: 'post',
    data: params
  })
}

export function detailIndex(indexName) {
  return request({
    url: '/index/detail/' + indexName,
    method: 'get'
  })
}

export function docSearch(indexName, params) {
  return request({
    url: '/docquery/' + indexName + "/search",
    method: 'post',
    data: params
  })
}

export function docDelete(indexName, docId) {
  return request({
    url: '/docquery/' + indexName + "/delete/" + docId,
    method: 'get'
  })
}